{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "c4a16b10",
   "metadata": {},
   "outputs": [],
   "source": [
    "import cv2 as cv\n",
    "\n",
    "img = cv.imread('data/messi5.jpg')\n",
    "if img is None:\n",
    "    print(\"[ERROR] fail to read Image!!!\")\n",
    "    exit(0)\n",
    "\n",
    "b,g,r = cv.split(img)\n",
    "\n",
    "cv.imshow(\"pic\", b)\n",
    "cv.waitKey(0)\n",
    "cv.imshow(\"pic\", g)\n",
    "cv.waitKey(0)\n",
    "cv.imshow(\"pic\", r)\n",
    "cv.waitKey(0)\n",
    "\n",
    "mergeImg = cv.merge((b,g,r))\n",
    "cv.imshow(\"pic\", mergeImg)\n",
    "cv.waitKey(0)\n",
    "\n",
    "cv.destroyAllWindows()\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "b85b4fd7",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.10"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
